package com.test.daily.leetcode.y2022.m07.day0720.v04;

/**
 * @descriptions:
 * @author: Tom
 * @date: 2022/7/20 下午 03:16
 * @version: 1.0
 */
public class Solution {
    public static int max1(Time[] arr){
        return process1(arr, 0, 0);
    }
    public static class Time{
        int start;
        int end;
        public Time(int start, int end){
            this.start = start;
            this.end = end;
        }
    }
    public static int process1(Time[] arr, int done, int timeLine){
        if (arr.length == 0){
            return done;
        }
        int max = done;
        for (int i = 0; i < arr.length; i++) {
            if(arr[i].start > timeLine){
                max = Math.max(max, process1(merge(arr, i), done+1, arr[i].end));
            }
        }
        return max;
    }
    public static Time[] merge(Time[] arr, int i){
        Time[] help = new Time[arr.length - 1];
        int k = 0;
        for(int j = 0; j < arr.length; j++){
            if(j != i){
                help[k++] = arr[j];
            }
        }
        return help;
    }

}
